package com.ziven.common.widget.value;

import android.view.View;

import androidx.annotation.NonNull;

import com.ziven.easygo.util.ViewHelper;

/**
 * @author Ziven
 */
public final class Enable extends Value {

    public static Enable enable() {
        return enable(true);
    }

    public static Enable disable() {
        return enable(false);
    }

    public static Enable enable(boolean enable) {
        return new Enable().accept(my -> my.value = enable);
    }

    private Enable() {}

    @Override
    protected void takeEffect(@NonNull ViewHelper<? extends View> helper) {
        helper.getViewNulls().doNotNull(view -> value(Boolean.class, view::setEnabled));
    }
}
